From: Julien Grall Date: Fri, 20 Feb 2015 15:58:28 +0000 (+0000) Subject: xen/xsm: Generate the permission in a spec-compliant way X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3727 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=0b81a749a6cbbbbed7462e7b662485e799ac8fee;p=xen.git xen/xsm: Generate the permission in a spec-compliant way Each class can contains 32 permisions which are encoded on a word (one bit per permission). Currently the awk script will generate an hexadecimal value for each permission. This may result to generate an invalid value on some version of awk. For instance debian jessie is using a version of mawk where (1 << 31) will result to 0x7fffffff. This is because the awk specification requires to do the arithmetic with float. So the resulting integer may vary following the implementation. As the generated headers are only used by C code, generate the permission define via "1UL << n". Signed-off-by: Julien Grall Acked-by: Daniel De Graaf --- diff --git a/xen/xsm/flask/policy/mkaccess_vector.sh b/xen/xsm/flask/policy/mkaccess_vector.sh index 8ec87f7b8c..7fa4aaf638 100644 --- a/xen/xsm/flask/policy/mkaccess_vector.sh +++ b/xen/xsm/flask/policy/mkaccess_vector.sh @@ -42,7 +42,7 @@ $1 == "class" { } av_defined[tclass] = 1; - permission = 1; + permission = 0; nextstate = "INHERITS_OR_CLASS-OPENBRACKET"; next; @@ -108,8 +108,8 @@ $1 == "{" { for (i = 0; i < spaces; i++) printf(" ") > outfile; - printf("0x%08xUL\n", permission) > outfile; - permission = permission * 2; + printf("(1UL << %u)\n", permission) > outfile; + permission = permission + 1; } $1 == "}" { if (nextstate != "CLASS-CLOSEBRACKET" &&